翻訳と辞書
Words near each other
・ Trial by Fire (The Outer Limits)
・ Trial by Fire (Yngwie Malmsteen album)
・ Trial by Jury
・ Trial by Jury (disambiguation)
・ Trial by Jury (film)
・ Trial by Jury (TV series)
・ Trial by jury in Scotland
・ Trial by media
・ Trial by ordeal
・ Trial by Self
・ Trial by water
・ Trial consulting
・ Trial court
・ Trial de novo
・ Trial des Nations
Trial division
・ Trial Farm
・ Trial film
・ Trial garden
・ Trial graphics
・ Trial Harbour
・ Trial in absentia
・ Trial Islands (British Columbia)
・ Trial Islands Ecological Reserve
・ Trial Islands Lighthouse
・ Trial Kennedy
・ Trial master file
・ Trial of Anders Behring Breivik
・ Trial of Archbishop Laud
・ Trial of Arne Cheyenne Johnson


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Trial division : ウィキペディア英語版
Trial division

Trial division is the most laborious but easiest to understand of the integer factorization algorithms. The essential idea behind trial division tests to see if an integer ''n'', the integer to be factored, can be divided by each number in turn that is less than ''n''. For example, for the integer , the only numbers that divide it are 1,2,3,4,6,12. Selecting only the largest powers of primes in this list gives that .
== Method ==
Given an integer ''n'' (throughout this article, ''n'' refers to "the integer to be factored"), trial division consists of systematically testing whether ''n'' is divisible by any smaller number. Clearly, it is only worthwhile to test candidate factors less than ''n'', and in order from two upwards because an arbitrary ''n'' is more likely to be divisible by two than by three, and so on. With this ordering, there is no point in testing for divisibility by four if the number has already been determined not divisible by two, and so on for three and any multiple of three, etc. Therefore, effort can be reduced by selecting only prime numbers as candidate factors. Furthermore, the trial factors need go no further than \scriptstyle\sqrt because, if ''n'' is divisible by some number ''p'', then ''n = p × q'' and if ''q'' were smaller than ''p'', ''n'' would have earlier been detected as being divisible by ''q'' or a prime factor of ''q''.
A definite bound on the prime factors is possible. Suppose ''Pi'' is the ''ith prime, so that ''P1'' = 2, ''P2'' = 3, ''P3'' = 5, etc. Then the last prime number worth testing as a possible factor of ''n'' is ''Pi'' where ''P2i + 1'' > ''n''; equality here would mean that ''Pi + 1'' is a factor. Thus, testing with 2, 3, and 5 suffices up to ''n'' = 48 not just 25 because the square of the next prime is 49, and below ''n'' = 25 just 2 and 3 are sufficient. Should the square root of ''n'' be integral, then it is a factor and ''n'' is a perfect square.
An example of the trial division algorithm, using a prime sieve for prime number generation, is as follows (in Python):

def trial_division(n):
"""Return a list of the prime factors for a natural number."""
if n < 2:
return []
prime_factors = []
for p in prime_sieve(int(n
*
*0.5) + 1):
if p
*p > n: break
while n % p == 0:
prime_factors.append(p)
n //= p
if n > 1:
prime_factors.append(n)
return prime_factors

Trial division is guaranteed to find a factor of ''n'' if there is one, since it checks all possible prime factors of ''n''. Thus, if the algorithm finds one factor, n, it is proof that ''n'' is a prime. If more than one factor is found, then ''n'' is a composite integer. A more computationally advantageous way of saying this is, if any prime whose square does not exceed ''n'' divides it without a remainder, then ''n'' is not prime.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Trial division」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.